// This function is almost identical to the shortcut function in search.html
function multiIsCommand(t)
{
// look for matching commands first
var search = null;
var term = null;
var result = t.match(/^([a-zA-Z]+)\b/)
if (result)
{
if (aliases[result[1]])
{
search = aliases[result[1]];
term = t.slice(result[1].length);
}
}
// then look for longest matching punctuation prefix
if (!search)
{
result = t.match(/^([\s~`!@#$%\^&\*()\-=\+{}\[\];:'<>,\.\/\?]+)/);
if (result)
{
for (var subs = result[1].length; subs>0; subs--)
{
search = aliases[result[1].slice(0, subs)];
if (search)
{
term = t.slice(subs);
break;
}
}
}
}
// then look for longest matching punctuation suffix
if (!search)
{
result = t.match(/([\s~`!@#$%\^&\*()\-=\+{}\[\];:'<>,\.\/\?]+)$/);
if (result)
{
for (var subs = result[1].length; subs>0; subs--)
{
search = aliases[result[1].slice(-subs)];
if (search)
{
term = t.slice(0, -subs);
break;
}
}
}
}
// no match, no dice
if (!search)
return false;
// return the proper search term for the asking procedure
return search;
}
// the multi function actually performs the multiple searches given
// the input parameters. if the user's reuseBrowserWindowMode parameter
// is set to 1, multi will not work. Also, if the user's launchmode
// is not set to zero, multi will pause between searches
// to allow multi to work with browsers other than IE.
function multi(q)
{
if ( reuseBrowserWindowMode == 1 )
{
alert("Multisearch requires the reuseBrowserWindowMode parameter to be set to zero or two. Otherwise, all the searches will be spawned in the same window.");
return false;
}
if ( nullArgs("multi", q) )
return false;
else
if (result = q.split( /[,\s]+/ ) )
{
var arrCmds = new Array(0);
var arrParams = new Array(0);
// Loop through the arguments to filter out the commands.
// if an argument is not a command, then no future arguments
// can be commands either. The following variable keeps track of this.
var fLoopBool = 1;
var strCommandName;
for ( var i = 1; i <= result.length; i++ )
{
strCommandName = multiIsCommand(result[i - 1]);
if (strCommandName != false && fLoopBool == 1)
{
// Append the command list with this command
arrCmds.push(strCommandName);
}
else
{
// Set the fLoopBool to zero since no more commands should be found